#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2017/6/14 0:40
# @Author  : Sunsray
# @File    : adminx.py
# @Software: PyCharm

import xadmin
from xadmin import views

from .models import EmailVerifyRecord, Banner


class BaseSetting(object):
    """
    开启主题
    """
    enable_themes = True
    use_bootswatch = True


class GlobalSetting(object):
    site_title = "管理后台 beta"  # 后台标题
    site_footer = "新中新云技术运维组"  # footer
    menu_style = "accordion"  # 收起后台左侧菜单


class EmailVerifyRecordAdmin(object):
    list_display = ['code', 'email', 'send_type', 'send_time']
    search_fields = ['code', 'email', 'send_type']
    list_filter = ['code', 'email', 'send_type', 'send_time']


class BannerAdmin(object):
    list_display = ['title', 'image', 'url', 'index', 'add_time']
    search_fields = ['title', 'image', 'url', 'index']
    list_filter = ['title', 'image', 'url', 'index', 'add_time']


xadmin.site.register(EmailVerifyRecord, EmailVerifyRecordAdmin)
xadmin.site.register(Banner, BannerAdmin)
xadmin.site.register(views.BaseAdminView, BaseSetting)
xadmin.site.register(views.CommAdminView, GlobalSetting)
